<?php 
include'../Classes/attstudentHandler.php';
include '../Classes/db.php';

$u=new Dbconnect();
$con=$u->getConnection();

$regno=$_GET['regno'];
$dt1=$_GET['date'];
$subgr=$_GET['subgr'];

$month=substr($dt1,3,2);
$year=substr($dt1,6,4);
$date=substr($dt1,0,2);
$day=$year."-".$month."-".$date;//create a new object
$id=$_GET['id'];

$time_now=mktime(date('H')+5,date('i')+30,date('s'),date('m'),date('d'),date('Y'));
		$yearnw=date('Y',$time_now); 
 		$monthnw=date('m',$time_now); 
 		$datenw=date('d',$time_now);

$att=new AttStudentHandler();//create a new object
	$att->setRegno($regno);
	$att->setSubgr($subgr);
	$att->setDay($day);
	$att->setMonth($month);
	$att->setConnect($con);

//future date validation
if (($year < $yearnw) || (($year == $yearnw)&&($month < $monthnw)) || (($year == $yearnw)&&($month = $monthnw)&&($date <= $datenw)))
			{
			$result=$att->attUpdate($id);
			echo $result;
			}
			else
			{
			echo "Future Date !";
			}
?>